{% extends 'homepage.html' %}

{% block content %}

<script type="text/javascript" src="{{ url_for('.static', filename='elliptic_modular_form_util-functions.js') }}"></script>
<script type="text/javascript" src="{{ url_for('.static', filename='elliptic_modular_form_scripts.js') }}"></script>


<script>
$(document).ready( function() {
$("#wait").text("Plot of fundamental domain is loading!");
$("#plot").load(function() {
         $("#wait").text("");
    });
}
);
</script>

<style>
table.ntdata th.left {
  border-right: 2px solid #9b9;
  background: #efe;
  border-bottom: 0;
  text-align: right;
}
table.ntdata td { text-align: left; }
table.ntdata th.weight {
  text-align: left;
  background: #efe;
  border-bottom: 2px solid #9b9;
  border-left: 0;
  vertical-align: center;
}
table.ntdata thead tr.space {
  background: #efe;
  border-bottom: 0;
}

table.ntdata thead th.spaceleft {
  border-right: 2px solid #9b9;
  vertical-align: top;
}

</style>

{% if error is defined %}

<h1>There was an error in meeting your previous request. Please change parameters.</h1>

<div> 
<h2> Error message: </h2>
{{ error | safe }}
</div>
{% endif %}

{% include 'geometric.html' %}

{% if level == 1 %}
  {% set group=KNOWL('mf.sl2z',title='\(\mathrm{SL}_2(\mathbb{Z})\)') %}
{% else %}
  {% if grouptype == 0 %}
    {% set group=KNOWL('mf.sl2.subgroup.gamma0N',title='\(\Gamma_0(' ~ level ~ ') \)') %}
  {% elif grouptype == 1 %}
    {% set group=KNOWL('mf.sl2.subgroup.gamma1N',title='\(\Gamma_1(' ~ level ~  ')\)') %}
  {% endif %}
{% endif %}

{% if browse_table is defined %}
{% set table = browse_table %}
{% if browse_table.rows is defined %}
{#{KNOWL('mf.ellipticemf_browse.all.info',title='Write about browsing') }#}
<p>
{% if grouptype == 1  %}
The table below gives the dimensions of the spaces of {{ KNOWL('mf.elliptic.newform',title='Newforms') }}
for \( \Gamma_1({{level}}) \) of specified {{ KNOWL('mf.elliptic.weight',title='weight') }}, transforming
with specified {{ KNOWL('character.dirichlet',title='character') }} for \( \Gamma_0({{level}}) \).<br>
  {% if table.maxGalCount is defined %}
    {% set maxGalCount = table.maxGalCount %}
    {% if maxGalCount > 1 %}
      {% set showGaloisOrbits = True %}
      In the table, we only list one representative per
     {{ KNOWL('character.dirichlet.galois_orbit',title='Galois orbit') }}.
     The complete Galois orbits are listed in the second table below.
    {% else %}
      {% set showGaloisOrbits = False %}
    {% endif %}
  {% endif %}
{% else %}
The table below gives the dimensions of the space of holomorphic cusp
forms for  \( \Gamma_0({{level}}) \) with trivial {{ KNOWL('character.dirichlet',title='character') }}.
{% endif %}
</p>
{% set rows = browse_table.rows %}
{% set row_class = cycler('odd', 'even') %}
{% set len = table.col_heads | length %}
{% set wid = 10*len +20 %}
<table class="ntdata" width="{{wid}}px">
  <thead>
    <tr class="space">
      <th class="spaceleft">Character</th>
      <th class="weight" colspan="{{table.col_heads|length}}">
	<span>Weight</span>
      </th>
    </tr>
    <tr class="space">
      <th class="spaceleft"></th>
      {% for k in table.col_heads  %}
      {% set col_url = url_for('emf.render_elliptic_modular_forms',level=level,weight=k) %}
      <th class="weight"><a href="{{col_url}}">{{k}}</a></th>
      {% endfor %}
    </tr>
  </thead>
  <tbody>
    {% for row in rows  %}
    <tr class="{{row_class.next() }}">
      <th width="10px" class="left">
	{% if row.url != '' %}
          <a href="{{row.url}}">{{ row.head }}</a>
        {% else %}
	  {{row.head}}
	{% endif %}
      </th>
      {% for cell in row.cells  %}
      <td align="center" width="0%">
        {% if cell.url != '' %}
          <a href="{{cell.url}}">{{cell.dim}}</a>
        {% else %}
	  {{cell.dim}}
	{% endif %}
      </td>
      {% endfor %}
    </tr>
    {% endfor %}
  </tbody>
</table>

{% if grouptype==1 and showGaloisOrbits %}
<table class="ntdata" width="{{wid}}px">
  <thead>
    <tr class="space">
      <th class="spaceleft">Representative</th>
      <th class="weight" colspan="{{maxGalCount}}">Galois orbit</th>
    </tr>
  </thead>
  <tbody>
    {% for row in rows  %}
    <tr class="{{row_class.next() }}">
      <th width="10px" class="left">
	{% if row.url != '' %}
          <a href="{{row.url}}">{{ row.head }}</a>
        {% else %}
	  {{row.head}}
	{% endif %}
      </th>
      {% for chi in row.galois_orbit  %}
      <td align="center" width="0%">
        {% if chi.url != '' %}
          <a href="{{chi.url}}">{{ chi.chi }}</a>
        {% else %}
	  {{chi.chi}}
	{% endif %}
      </td>
      {% endfor %}
      {% if maxGalCount is defined %}
        {% set rc = row.galois_orbit|count %}
        {% for j in range(rc,maxGalCount) %}
          <td>&nbsp;</td>
        {% endfor %}
      {% endif  %}
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endif %}
{% endif %}
{% elif list_spaces is defined %}

{{ list_spaces | safe }}

{% else%}
  <h1>This data is not available yet.</h1>
{% endif %}


{% endblock content %}
